package com.ruoyi.web.controller.smartHighway;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.smartHighway.service.IAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * AppController
 * 
 * @author ljj
 * @date 2024-08-06
 */
@Api("app接口")
@RestController
@RequestMapping("/smartHighway/app")
public class AppController extends BaseController{

    @Autowired
    private IAppService appService;

    /**
     * 查询收费站列表
     */
    @ApiOperation("查询站点列表")
    @GetMapping("getStationList")
    public TableDataInfo getStationList() {
        List<Map<String,Object>> list = appService.getStationList();
        return getDataTable(list);
    }

    @ApiOperation("获取收费站运营数据-实时")
    @GetMapping(value = "getTollOperationByStationId")
    public AjaxResult getTollOperationByStationId(@RequestParam String stationId) {
        return success(appService.getTollOperationByStationId(stationId));
    }

    @ApiOperation("查询设备列表")
    @PostMapping("queryDeviceList")
    public TableDataInfo queryDeviceList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryDeviceList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("获取设备种类和数量")
    @PostMapping("queryDeviceNum")
    public TableDataInfo queryDeviceNum(@RequestBody Map<String,Object> queryMap) {
        List<Map<String,Object>> list = appService.queryDeviceNum(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("查询设施列表")
    @PostMapping("queryFacilityList")
    public TableDataInfo queryFacilityList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryFacilityList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("获取设施种类和数量")
    @GetMapping(value = "getFacilityNum")
    public AjaxResult getFacilityNum() {
        return success(appService.getFacilityNum());
    }


    @ApiOperation("获取公路技术状况桥梁等级评分列表")
    @PostMapping(value = "queryBridgeGradeList")
    public TableDataInfo queryBridgeGradeList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryBridgeGradeList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("查询桥梁列表信息")
    @PostMapping(value = "queryBridgeInfoList")
    public TableDataInfo queryBridgeInfoList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryBridgeInfoList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("根据id查看桥梁扎点详情")
    @GetMapping(value = "getBridgeInfoById")
    public AjaxResult getBridgeInfoById(@RequestParam int bridgeId) {
        return success(appService.getBridgeInfoById(bridgeId));
    }

    @ApiOperation("获取公路技术状况路面等级评分列表")
    @PostMapping(value = "queryRoadGradeList")
    public TableDataInfo queryRoadGradeList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryRoadGradeList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("获取平均拥堵指数-实时")
    @GetMapping(value = "getRoadCondition")
    public AjaxResult getRoadCondition() {
        return success(appService.getRoadCondition());
    }

    @ApiOperation("查询事件信息列表")
    @PostMapping(value = "queryEventList")
    public TableDataInfo queryEventList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryEventList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("查询养护工程列表")
    @PostMapping(value = "queryShowInfoList")
    public TableDataInfo queryShowInfoList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryShowInfoList(queryMap);
        return getDataTable(list);
    }

    @ApiOperation("查询结构物基础信息列表")
    @PostMapping(value = "queryShowStructureList")
    public TableDataInfo queryShowStructureList(@RequestBody Map<String,Object> queryMap) {
        startPage();
        List<Map<String,Object>> list = appService.queryShowStructureList(queryMap);
        return getDataTable(list);
    }
}
